const libraryFile = {
  namespaced: true,
  state: {
    pathArr: [{filePath:'/',id:0}],
    courseArr:[{}]
  },
  getters: {
    pathArr: state => state.pathArr,
    courseArr: state => state.courseArr
  },
  mutations: {
    // 添加path
    addPath(state, path) {
      state.pathArr.push(path);
    },
    // 清空path
    clearPathArr(state) {
      state.pathArr = [{filePath:'/',id:0}];
    },
    // 替换path
    changePathArr(state,arr) {
      console.log(arr,'--------')
      state.pathArr = arr;
    },
    // 去除指定后面的所有path
    removePath(state, index) {
      state.pathArr = state.pathArr.slice(0, index + 1);
    },
    // 添加path
    addcoursePath(state, path) {
      state.courseArr.push(path);
    },
    // 清空path
    clearcoursePathArr(state) {
      state.courseArr = [{}];
    },
    // 去除指定后面的所有path
    removecoursePath(state, index) {
      state.courseArr = state.courseArr.slice(0, index + 1);
    },

  },
};

export default libraryFile;
